#define _CRT_SECURE_NO_WARNINGS 1
/**
 * Definition for singly-linked list.
 * struct ListNode {
 *     int val;
 *     struct ListNode *next;
 * };
 */
typedef struct ListNode S;
bool hasCycle(struct ListNode* head) {
	S* low = head;
	S* fast = head;
	while (fast && fast->next)
	{
		low = low->next;
		fast = fast->next->next;
		if (fast == low)
		{
			return fast;
		}
	}
	return NULL;
}